home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc1_2_x
/
inptmthd.sit
/
Input Methods
/
card_11494.txt
< prev
next >
Wrap
Text File
|
1989-11-24
|
3KB
|
120 lines
-- card: 11494 from stack: in
-- bmap block id: 11555
-- flags: 4000
-- background id: 2696
-- name: Single Keypress
----- HyperTalk script -----
-- Thanks to Nigel Perry for the controlLock XCMD
-- Department of Computing,Imperial College
-- London,SW7England, email: np@uk.ac.ic.doc
on openCard
-- lock the stack on this card to make the letters fall faster
-- and to reduce disk access
set the cantModify of this stack to true
controlLock on -- make keypresses generate controlKey message
pass openCard
end openCard
on closeCard
set the cantModify of this stack to false -- unlock the stack
controlLock off -- turn key message thing off
cleanUp
pass closeCard
end closeCard
-- A controlKey message is generated by any keypress
on controlKey keyNum
global letterState, letterNum
if letterState = 100 then -- letter is currently dropping
-- change lowercase to upper
if keyNum > 96 then subtract 32 from keyNum
if keyNum = letterNum then
rightSound
cleanUp
end if
end if
end controlKey
on cleanUp
global letterState
put 0 into letterState
hide card field "Letter"
end cleanUp
on idle
global letterState, letterNum, letterH, letterV
if letterState < 10 then -- pause before dropping letter
add 1 to letterState
else if letterState Γëá 100 then -- start dropping a new letter
put 100 into letterState
put 330 into letterH
put 120 into letterV
put random(26)+64 into letterNum -- pick a random letter
put numToChar of letterNum into card field "Letter"
else -- continue dropping
show card field "Letter" at letterH, letterV
add 20 to letterV
if letterV > 330 then -- hit the bottom
hide card field "Cover"
play "Splat"
wait until the sound is "done"
cleanUp
show card field "Cover"
end if
end if
pass idle
end idle
-- part 3 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=286 top=305 right=339 bottom=371
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Cover
-- part 1 (field)
-- low flags: 80
-- high flags: 0000
-- rect: left=294 top=162 right=199 bottom=367
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 28
-- style flags: 256
-- line height: 37
-- part name: Letter
-- part 2 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=16 top=131 right=170 bottom=230
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 14
-- style flags: 0
-- line height: 18
-- part name:
-- part contents for card part 2
----- text -----
Press the falling letter's key before it splats!
-- part contents for card part 1
----- text -----
C